package com.itheima.service;

import com.itheima.common.R;
import com.itheima.dto.SetDefaultVo;
import com.itheima.pojo.AddressBook;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 小帅蓝
 * @Date 2022/6/22 19:08
 */
public interface AddressBookService {

    /**
     * 获取默认收货地址
     *
     * @return R<AddressBook>
     */
    R<AddressBook> queryDefault();

    /**
     * 设置默认收获地址
     *
     * @param addressBook 地址
     * @return R<AddressBook>
     */
    @Transactional
    R<AddressBook> setDefault(AddressBook addressBook);

    /**
     * 获取收货地址列表
     *
     * @return R<List < AddressBook>>
     */
    R<List<AddressBook>> queryAll();

    /**
     * 根据id获取收货地址
     *
     * @param id 收货地址id
     * @return R<AddressBook>
     */
    R<AddressBook> queryById(String id);

    /**
     * 添加收货地址
     *
     * @param addressBook AddressBook
     * @return R<AddressBook>
     */
    R<AddressBook> addAddressBook(AddressBook addressBook);

    /**
     * 批量逻辑删除收货地址
     *
     * @param ids 地址id
     * @return boolean
     */
    boolean deleteAddressBook(String ids);

    /**
     * 修改收货地址
     *
     * @param addressBook AddressBook
     * @return R<String>
     */
    R<String> updateAddressBook(AddressBook addressBook);

}
